from urllib import request

#不使用cookie请求大鹏董成腾主页
dapeng_url='http://www.renren.com/880151247/profile'
headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
        }
req=request.Request(url=dapeng_url,headers=headers)
resp=request.urlopen(req)
#print(resp.read().decode('utf-8'))
#使用cookie
dapeng_url='http://www.renren.com/880151247/profile'
headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
            'Cookie':'anonymid=k9tbnle5mlsxrs; depovince=HUN; _r01_=1; ick_login=b6041b46-ff28-49ec-b63b-27ffdfd7f23b; taihe_bi_sdk_uid=068c9c2ee0b531595b54eba1103ce369; taihe_bi_sdk_session=15d9a7d366ff317964b7f8f6f6fac632; jebecookies=ecea7c0f-520a-4e6c-9e3b-146b7b002fca|||||'
        }
req=request.Request(url=dapeng_url,headers=headers)
resp=request.urlopen(req)
print(resp.read().decode('utf-8'))